﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace MangioneManagement.Models
{
	public class Transaction
	{
		[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity), Display(Name = "Id de Transaccion", Order = 1)]
		public int TransactionId { get; set; }

		[Display(Name = "Cliente", Order = 2)]
		public Customer Customer { get; set; }
		
		[Display(Name = "Producto", Order = 3)]
		public Product Product { get; set; }
		
		[Display(Name = "Fecha", Order = 4)]
		public DateTime Date { get; set; }
     
        [MaxLength(255), Display(Name = "User",  Order = 5)]
        public string Username { get; set; }

        #region Navigation Properties
        [NotMapped]
        public string CurrentCustomer { get {return this.Customer.LastName +", "+this.Customer.FirstName; } }
        [NotMapped]
        public string CurrentProduct { get {return this.Product.Brand + " " + this.Product.Model; } }
        #endregion

    }
}